package com.ledict.casefiling.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;

public class ShiroSSOConfig {
    private static final String ssoServerPrefixUrl = "";
    private static final String ssoLoingUrl = "";
    private static final String ssoLogoutUrl = "";

    public static final String shiroServerPrefixUrl = "";
    public static final String ssoFilterUrlPattern = "";

    public static final String loginUrl = ssoLoingUrl + "?service=" + shiroServerPrefixUrl + ssoFilterUrlPattern;

    /**
     * 注册单点登出listener
     * @return
     */
    @Bean
    public ServletListenerRegistrationBean singleSignOutHttpSessionListener() {
        ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean();

        bean.setEnabled(true);

        return bean;
    }

    /**
     * 注册单点登出filter
     * @return
     */
    @Bean
    public FilterRegistrationBean singleSignOutFilter(){
        FilterRegistrationBean bean = new FilterRegistrationBean();
        bean.setName("singleSignOutFilter");
        /*bean.setFilter(new SingleSignOutFilter());*/
        bean.addUrlPatterns("/*");
        bean.setEnabled(true);
        return bean;
    }

}
